package com.uphone.kingmall.adapter;

import android.view.ViewGroup;
import android.widget.ImageView;

import com.blankj.utilcode.util.ScreenUtils;
import com.blankj.utilcode.util.SizeUtils;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.china.zhuoyue.R;
import com.uphone.kingmall.app.MyApplication;
import com.uphone.kingmall.bean.GoodCommentsBean;
import com.uphone.kingmall.utils.GlideUtils;

public class CommentsListImageAdapter extends BaseQuickAdapter<GoodCommentsBean.DataBean.ImgsBean, BaseViewHolder> {

    public CommentsListImageAdapter() {
        super(R.layout.kingmall_item_comment_list_image);
    }

    @Override
    protected void convert(BaseViewHolder helper, GoodCommentsBean.DataBean.ImgsBean item) {
        ImageView imageView = helper.getView(R.id.iv_image);
        ViewGroup.LayoutParams params = imageView.getLayoutParams();
        int width = (int) ((ScreenUtils.getScreenWidth() - SizeUtils.dp2px(40)) / 3d);
        params.width = width;
        params.height = width;
        imageView.setLayoutParams(params);
        GlideUtils.getInstance().loadCornerImage(MyApplication.mContext, item.getImg(), 7, imageView);
    }
}
